import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/login'), hidden: true },
  // { path: '/404', component: () => import('@/views/404'), hidden: true },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/layout',
    component: () => import('@/components/Layout'), //  router-view
    children: [
      {
        path: '',
        redirect: '/layout/bottom'
      },
      {
        path: '/layout/bottom',
        component: () => import('@/components/BottomPart'),
        children: [
          {
            path: '',
            redirect: '/layout/bottom/center'
          },
          {
            path: '/layout/bottom/center',
            component: () => import('@/components/components/CenterArea'),
            children: [
              {
                path: '',
                redirect: 'user'
              },
              {
                path: 'user',
                redirect: 'user/index'
              },
              {
                path: 'user/index',
                component: () => import('@/components/components/userModule/UserIndex')
              },
              {
                path: 'user/addoredit/:id',
                component: () => import('@/components/components/userModule/AddUser')
              },
              {
                path: 'user/assignRole/:id',
                component: () => import('@/components/components/userModule/AssignRole')
              },
              {
                path: 'role',
                redirect: 'role/index'
              },
              {
                path: 'role/index',
                component: () => import('@/components/components/RoleModule/RoleIndex')
              },
              {
                path: 'role/addpermission/:id',
                component: () => import('@/components/components/RoleModule/AddPermission')
              },
              {
                path: 'permission',
                redirect: 'permission/index'
              },
              {
                path: 'permission/index',
                component: () => import('@/components/components/PermissionModule/PermissionIndex')
              }
            ]
          }
        ]
      },
      {
        path: '/hello',
        component: () => import('@/components/zTree')
      }
    ]
  }
]
export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
